<?php

/************************************************************/
/* IMPORTANT NOTE FOR THEMES DEVELOPERS!                    */
/*                                                          */
/* When you start cCarsng your theme, if you want to     */
/* distribute it, please double check it to fit the HTML    */
/* 4.01 Transitional Standard. You can use the W3 validator */
/* located at http://validator.w3.org                       */
/* If you don't know where to start with your theme, just   */
/* start mCarsfying this theme, it's validate and is cool*/
/************************************************************/

/************************************************************/
/* Theme Colors Definition                                  */
/*                                                          */
/* Define colors for your web site. $bgcolor2 is generaly   */
/* used for the tables border as you can see on OpenTable() */
/* function, $bgcolor1 is for the table background and the  */
/* other two bgcolor variables follows the same criteria.   */
/* $texcolor1 and 2 are for tables internal texts           */
/************************************************************/

global $loonr, $prefix, $db, $kokku;
$kokku = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories LIMIT 0, 30 "));


$bgcolor1 = "#2D6386";
$bgcolor2 = "#2D6386";
$bgcolor3 = "#2D6386";
$bgcolor4 = "#2D6386";
$textcolor1 = "#000000";
$textcolor2 = "#000000";

if ($loonr == "") {
    $loonr = "0";
}

include("themes/Cars/tables.php");

/************************************************************/
/* Function themeheader()                                   */
/*                                                          */
/* Control the header for your site. You need to define the */
/* BODY tag and in some part of the code call the blocks    */
/* function for left side with: blocks(left);               */
/************************************************************/

function themeheader() {
    global $user, $banners, $sitename, $slogan, $cookie, $prefix, $db;
    cookiedecode($user);
    $username = $cookie[1];
    if ($username == "") {
        $username = "Anonymous";
    }
    echo "<body bgcolor=\"#2D6386\" text=\"#000000\"  leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";
    if ($banners) {
	include("banners.php");
    }
    $topics_list = "<select name=\"topic\" onChange='submit()'>\n";
    $topics_list .= "<option value=\"\">All Topics</option>\n";
    $toplist = $db->sql_query("select topicid, topictext from ".$prefix."_topics order by topictext");
    while(list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
	$topicid = intval($topicid);
    if ($topicid==$topic) { $sel = "selected "; }
	$topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";
	$sel = "";
    }
    if ($username == "Anonymous") {
	$theuser = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account\">Create an account";
    } else {
	$theuser = "&nbsp;&nbsp;Welcome $username!";
    }
    $public_msg = public_message();
    $tmpl_file = "themes/Cars/header.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
    blocks(left);
    $tmpl_file = "themes/Cars/left_center.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themefooter()                                   */
/*                                                          */
/* Control the footer for your site. You don't need to      */
/* close BODY and HTML tags at the end. In some part call   */
/* the function for right blocks with: blocks(right);       */
/* Also, $index variable need to be global and is used to   */
/* determine if the page your're viewing is the Homepage or */
/* and internal one.                                        */
/************************************************************/

function themefooter() {
    global $index, $foot1, $foot2, $foot3, $foot4;


    if ($index == 1) {
	$tmpl_file = "themes/Cars/center_right.html";
	$thefile = implode("", file($tmpl_file));
	$thefile = addslashes($thefile);
	$thefile = "\$r_file=\"".$thefile."\";";
	eval($thefile);
	print $r_file;
	blocks(right);
    }
    $footer_message = "$foot1$foot2$foot3$foot4";
    $tmpl_file1 = "themes/Cars/footer1.html";
	$tmpl_file2 = "themes/Cars/footer2.html";
    $thefile1 = implode("", file($tmpl_file1));
	$thefile2 = implode("", file($tmpl_file2));
    $thefile1 = addslashes($thefile1);
	$thefile2 = addslashes($thefile2);	
    $thefile = "\$r_file=\"".$thefile1."".$thefile2."\";";
    //"<!-- Start of StatCounter Code --><script type=\"text/javascript\">	var sc_project=3275246;	var sc_invisible=0;	var sc_partition=21;	var sc_security=\"1a2da267\";	var sc_text=3;		</script>	<script type=\"text/javascript\" src=\"http://www.statcounter.com/counter/counter_xhtml.js\"></script><noscript><div class=\"statcounter\"><a class=\"statcounter\" href=\" http://www.statcounter.com/\"><img class=\"statcounter\" src=\"http://c22.statcounter.com/3275246/0/1a2da267/0/ \" alt=\"web metrics\" /></a></div></noscript>	<!-- End of StatCounter Code -->"
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themeindex()                                    */
/*                                                          */
/* This function format the stories on the Homepage         */
/************************************************************/


//yves
function iPrintHeader() {
    $tmpl_file = "themes/Cars/story_home_header.html";
	$thefile = implode("", file($tmpl_file));
	$thefile = addslashes($thefile);
	$thefile = "\$r_file=\"".$thefile."\";";
	eval($thefile);
	print "$r_file";
}

//yves
function iPrintFooter() {
    $tmpl_file = "themes/Cars/story_home_footer.html";
	$thefile = implode("", file($tmpl_file));
	$thefile = addslashes($thefile);
	$thefile = "\$r_file=\"".$thefile."\";";
	eval($thefile);
	print "$r_file";
}

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous, $tipath, $cookie, $loonr, $vasak, $kokku, $storyhome, $storynum; 
    $ThemeSel = get_theme();
    if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
	$t_image = "themes/$ThemeSel/images/topics/$topicimage";
    } else {
	$t_image = "$tipath$topicimage";
    }
    $loonr = ($loonr+1);
    if (isset($cookie[3])) {
	$storynum = $cookie[3];
    } else {
	$storynum = $storyhome;
    }
    $ridaaa = round($loonr/2);
    /*if ($notes != "") {
	$notes = "<br><br><b>"._NOTE."</b> <font color=red><i>$notes</i></font>\n";
    } else {*/
	$notes = "";
    //}
	//Suppress the test that makes cite the text non written by admin
    //if ("$aid" == "$informant") {
		$content = "$thetext$notes\n";
    /*} else {
		if($informant != "") {
		    $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
		} else {   $content = "$anonymous "; }
		$content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
    }*/
    $posted = ""._POSTEDBY." ";
    $posted .= get_author($aid);
    $posted .= " "._ON." $time $timezone ($counter "._READS.")";
    if ($ridaaa = $loonr) {
	$tmpl_file = "themes/Cars/story_home.html";
	$thefile = implode("", file($tmpl_file));
	$thefile = addslashes($thefile);
	$thefile = "\$r_file=\"".$thefile."\";";
	eval($thefile);
	print "$r_file";
	
    }
}

/************************************************************/
/* Function themeindex()                                    */
/*                                                          */
/* This function format the stories on the story page, when */
/* you click on that "Read More..." link in the home        */
/************************************************************/

//deprecated
function themearticle ($my_pictures, $hometext, $aid, $informant, $datetime, 
				$title, $bodytext, $topic, $topicname, $topicimage, $topictext) {
    global $admin, $sid, $tipath;
    $thetext = "<table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td width=220 rowspan=2 
    	valign=top>$my_pictures</td><td height=25 valign=top>$bodytext<br></td> </tr><tr> 
    			 <td valign=top>$hometext</td> </tr></table>";
    $ThemeSel = get_theme();
    if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
	$t_image = "themes/$ThemeSel/images/topics/$topicimage";
    } else {
	$t_image = "$tipath$topicimage";
    }
    $posted = ""._POSTEDON." $datetime ";//._BY." ";
	$content = "$thetext\n";
    $tmpl_file = "themes/Cars/story_page.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";	
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themesidebox()                                  */
/*                                                          */
/* Control look of your blocks. Just simple.                */
/************************************************************/

function themesidebox($title, $content) {
    $tmpl_file = "themes/Cars/blocks.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

?>